<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
<ui:composition template="main.xhtml">
	<ui:define name="title">
		<h:outputText value="#{Lang.prop[MySession.l]['topmenuadmin']}" />
	</ui:define>
	<ui:define name="body">
		<rich:tabPanel id="tab" switchType="client" headerAlignment="left" rendered="#{MySession.hasOp['100701']==true}">

			<rich:tab id="tab1" name="tab1" label="#{Lang.prop[MySession.l]['list']}">
				<h:panelGrid columns="2" columnClasses="tdTop,tdTop">

					<a4j:form id="treeForm">
						<fieldset class="fieldset"><legend> <h:outputText value="#{Lang.prop[MySession.l]['treemenu']}" /> </legend> <rich:tree reRender="editForm,mpForConfirm" style="margin:0px 5px 0px 1px;width:300px;" ajaxSubmitSelection="true" switchType="client" value="#{TopMenu.treeNode}" var="item" nodeSelectListener="#{TopMenu.processSelection}" ajaxKeys="#{null}">
							<rich:treeNode style="margin-left:3px;margin-top:3px;">
								<h:outputText value="#{item.menuName}" />
							</rich:treeNode>
						</rich:tree></fieldset>
					</a4j:form>

					<a4j:outputPanel id="editForm">
						<a4j:form>
							<fieldset class="fieldset" style="width: 267px;"><legend> <h:outputText value="#{Lang.prop[MySession.l]['topmenu']}" /> </legend> <h:panelGrid columns="3" columnClasses="co1,co2,co3">
								<h:outputText value="#{Lang.prop[MySession.l]['parentmenu']}:" />
								<h:outputText value="#{TopMenu.parentName}" />
								<h:outputText value="" />

								<h:outputText value="#{Lang.prop[MySession.l]['name']}:" />
								<h:inputText value="#{TopMenu.menuName}" style="width:100px;">
								</h:inputText>
								<h:outputText value="*" />

								<h:outputText value="#{Lang.prop[MySession.l]['menuurl']}:" />
								<h:inputText value="#{TopMenu.menuUrl}" style="width:200px;">
								</h:inputText>
								<h:outputText value="" />

								<h:outputText value="#{Lang.prop[MySession.l]['menutarget']}:" />

								<h:selectOneMenu value="#{TopMenu.menuTarget}" class="select">
									<f:selectItem itemValue="_self" itemLabel="当前窗口" />
									<f:selectItem itemValue="_blank" itemLabel="新窗口" />
								</h:selectOneMenu>
								<h:outputText value="" />

								<h:outputText value="#{Lang.prop[MySession.l]['sequence']}:" />
								<h:inputText value="#{TopMenu.sequence}" style="width:30px;">
								</h:inputText>
								<h:outputText value="" />

								<h:outputText value="" />
								<h:panelGrid columns="4" rendered="#{MySession.hasOp['100702']==true}">
									<a4j:commandLink action="#{TopMenu.newRecord}" reRender="treeForm,msg">
										<h:outputText class="btn" value="#{Lang.prop[MySession.l]['newrecord']}" />
										<f:param name="parentId" value="#{TopMenu.parentId}" />
									</a4j:commandLink>
									<a4j:commandLink action="#{TopMenu.updateRecordById}" reRender="treeForm,msg">
										<h:outputText class="btn" value="#{Lang.prop[MySession.l]['save']}" rendered="#{TopMenu.ID_ gt 0}" />
										<f:param name="parentId" value="#{TopMenu.parentId}" />
										<f:param name="id" value="#{TopMenu.ID_}" />
									</a4j:commandLink>
									<a4j:commandLink action="#{TopMenu.moveRecordById}" reRender="treeForm,msg">
										<h:outputText class="btn" value="#{Lang.prop[MySession.l]['move']}" rendered="#{TopMenu.ID_ gt 0}" />
										<f:param name="parentId" value="#{TopMenu.parentId}" />
										<f:param name="id" value="#{TopMenu.ID_}" />
									</a4j:commandLink>
									<a4j:commandLink onclick="#{rich:component('mpForConfirm')}.show();" reRender="treeForm,msg">
										<h:outputText class="btn" value="#{Lang.prop[MySession.l]['delete']}" rendered="#{TopMenu.ID_ gt 0}" />
										<f:param name="parentId" value="#{TopMenu.parentId}" />
										<f:param name="id" value="#{TopMenu.ID_}" />
									</a4j:commandLink>
								</h:panelGrid>
								<h:outputText value="" />
							</h:panelGrid></fieldset>
						</a4j:form>
					</a4j:outputPanel>
				</h:panelGrid>
			</rich:tab>
		</rich:tabPanel>
		<a4j:form>
			<rich:modalPanel id="mpForConfirm" width="300" height="80" zindex="3002" style="clear:both;background:url(images/warning.png) no-repeat left #fcfae9;
border:1px #e9e6c7 solid;background-position:15px 10px;padding:20px 20px 15px 60px;margin:0 0 -10px 0;background-image:url(images/warning.png)">
				<a4j:outputPanel style="width:250px;margin-top:-10px;height:80px;">
					<h:panelGrid columns="3">
						<h:outputText value="#{Lang.prop[MySession.l]['deletewarning']}" style="font-size:11pt;" />
						<a4j:commandLink reRender="treeForm,editForm,msg" action="#{TopMenu.deleteRecordById}" onclick="#{rich:component('mpForConfirm')}.hide()">
							<h:outputText class="btn" value="#{Lang.prop[MySession.l]['ok']}" />
							<f:param name="parentId" value="#{TopMenu.parentId}" />
							<f:param name="id" value="#{TopMenu.ID_}" />
						</a4j:commandLink>
						<a4j:commandLink onclick="#{rich:component('mpForConfirm')}.hide()">
							<h:outputText class="btn" value="#{Lang.prop[MySession.l]['cancel']}" />
						</a4j:commandLink>
					</h:panelGrid>
				</a4j:outputPanel>
			</rich:modalPanel>
		</a4j:form>
	</ui:define>
</ui:composition>
</html>